class RTObject extends egret.Sprite{
	public arr_RT;
	public pic:egret.Bitmap;
	public raduisBegin;
	public raduisEnd;
	public speed;
	public raduisMinus;
	public angle;
	public BS;
	public bl_direction;

	public bl_appearance;
	public constructor() {
		super();
		this.arr_RT=new Array();
		this.bl_direction=true;
		this.bl_appearance=false;
	}
	public ZF(getBl){
		this.bl_direction=getBl;
	}
	public Initial(textureName,getBS,count,getRaduisBegin,getRaduisEnd,getSpeed,getAngle){
		this.raduisBegin=getRaduisBegin;
		this.raduisEnd=getRaduisEnd;
		this.speed=getSpeed;
		this.raduisMinus=0;
		this.angle=getAngle;
		this.BS=getBS;
		for(var z=0;z<count;z++){
			var pic=new egret.Bitmap(RES.getRes(textureName));

			
			pic.anchorOffsetX=pic.width/2;
			pic.anchorOffsetY=this.raduisBegin;

			pic.x=740/2;
			pic.y=1136/2-100;
			pic.rotation=this.angle+z*360/count;

			this.arr_RT.push(pic);
			this.addChild(pic);
		}

		this.addEventListener(egret.Event.ENTER_FRAME,this.EF,this);
	}
	
	public StartRT(getSpeed,bala){
		this.speed=getSpeed;
		this.raduisMinus=bala;
	} 
	public StartRTSpe(time,ZF){
		for(var z=0;z<this.arr_RT.length;z++){
			this.arr_RT[z].alpha=0;
			this.arr_RT[z].scaleX=0;this.arr_RT[z].scaleY=0;
		if(ZF){			
		    egret.Tween.get(this.arr_RT[z]).wait(time*z)
			.to({alpha:1,scaleX:1,scaleY:1},800,egret.Ease.backInOut);
		}
		else{
			 egret.Tween.get(this.arr_RT[z]).wait(time*(this.arr_RT.length-1-z))
			.to({alpha:1,scaleX:1,scaleY:1},800,egret.Ease.backInOut);
		}
		}
		
		


	}

	private EF(e:egret.Event){
		for(var z=0;z<this.arr_RT.length;z++){
			if(this.bl_direction){this.arr_RT[z].rotation+=this.speed;}
			if(!this.bl_direction){this.arr_RT[z].rotation-=this.speed;}
			if(this.BS=="S"&&this.arr_RT[z].anchorOffsetY-this.raduisMinus>this.raduisEnd){
			    this.arr_RT[z].anchorOffsetY-=this.raduisMinus;
			}
			else if(this.BS=="B"&&this.arr_RT[z].anchorOffsetY-this.raduisMinus<this.raduisEnd){
				this.arr_RT[z].anchorOffsetY-=this.raduisMinus;
			}
		}
		// for(var z=0;z<this.arr_RT.length;z++){
		// 	egret.Tween.get(this.arr_RT[z])
		// 	.to({rotation:this.arr_RT[z].rotation+720,anchorOffsetY:-this.raduisEnd
		// 		,ease:egret.Ease.cubicInOut()}
		// 	,2000)
		// 	.wait(1000)
		// 	.call(this.onComplete);
		// }
	}
	private onComplete(){

	}
}